Imports Aricie.DNN.Caching.Analysis.Graphs
Imports Microsoft.Msagl.Drawing
Imports QuickGraph
Imports Aricie.DNN.UI

Namespace Aricie.DNN.Caching.Analysis.Graphs
    Public MustInherit Class GraphImageHandler(Of V, E As IEdge(Of V))
        Inherits ImageHandler



        Public Overrides Function GetImage(ByVal context As System.Web.HttpContext, ByVal width As Integer, ByVal height As Integer) As System.Drawing.Bitmap

            Dim g As IEdgeListGraph(Of V, E) = Me.GetGraph(context)
            Dim command As MsaglLayoutCommand(Of V, E) = Me.GetCommand(context)
            Dim msaglGraph As Graph = GraphHelper.ToMsaglGraph(g, command)

            Return GraphHelper.ToBitmap(msaglGraph, width, height)

        End Function


        Public MustOverride Function GetCommand(ByVal context As System.Web.HttpContext) As MsaglLayoutCommand(Of V, E)

        Public MustOverride Function GetGraph(ByVal context As System.Web.HttpContext) As IEdgeListGraph(Of V, E)


    End Class
End Namespace